package com.yc.yyds.servlet;

import com.yc.yyds.Bean.Result;
import com.yc.yyds.biz.BizException;
import com.yc.yyds.biz.ShowMovieBiz;
import com.yc.yyds.util.ToJsonUtil;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "QueryMovieTimeServlet", value = "/QueryMovieTimeServlet.s")
public class QueryMovieTimeServlet extends HttpServlet {
    ShowMovieBiz biz =new ShowMovieBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Result result;
        try {
            List<Map<String, Object>> data = biz.movieDate();
            result =  new Result(1,"成功",data);
            ToJsonUtil.toJson(response,result);
        } catch (BizException e) {
            e.printStackTrace();
            result =  new Result(0,e.getMessage(),null);
            ToJsonUtil.toJson(response,result);
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
